import os
import sys
import atexit

# Set up the FIFO
thefifo = 'fifo'
os.mkfifo(thefifo)

# Make sure to clean up after ourselves
def cleanup():
    os.remove(thefifo)

atexit.register(cleanup)

# Go into reading loop
while True:
    with open(thefifo, 'r') as fifo:
        for line in fifo:
            print(line.strip())


# Usage:
# echo "Alice" >> fifo
